﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Util
{
    public class Logger
    {
        static StreamWriter streamWriter;
        static Logger()
        {
            string path = string.Format(@"{0}\{1}.log", Config.LogPath, DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss"));
            streamWriter = File.CreateText(path);
            streamWriter.AutoFlush = true;
        }

        public static void WriteLine(string format, params object[] args)
        {
            Console.WriteLine(format, args);
            streamWriter.WriteLine(format, args);
        }

        public static void WriteLine(string format, object o1)
        {
            Console.WriteLine(format, o1);
            streamWriter.WriteLine(format, o1);
        }

        public static void WriteLine(string format, object o1, object o2)
        {
            Console.WriteLine(format, o1, o2);
            streamWriter.WriteLine(format, o1, o2);
        }

        public static void WriteLine(string format, object o1, object o2, object o3)
        {
            Console.WriteLine(format, o1, o2, o3);
            streamWriter.WriteLine(format, o1, o2, o3);
        }
    }
}
